package com.ljq.config;

import com.ljq.annotation.DefaultConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

/**
 * @author：李嘉琦
 * @Version：1.0
 * @date：2017-08-16 23：26
 * @description：
 */

@DefaultConfiguration("com.ljq")
/*@EnableWebMvc*/
/*重写WebMvcConfigurerAdapter可对SpringMVC进行配置，同时需要开启@EnableWebMvc注解
* 不开启注解则配置类和注解同时生效 
* */
public class MvcConfig extends WebMvcConfigurerAdapter{

    /*//视图解析器
    @Bean
    public InternalResourceViewResolver viewResolver(){
        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
        viewResolver.setPrefix("/WEB-INF/classes/views");
        viewResolver.setSuffix(".html");
        return viewResolver;
    }*/

    //静态资源映射
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("*//**").addResourceLocations("classpath:/");
    }

    //快捷的视图控制器
    /*@Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/login").setViewName("/login");
    }*/

    //路径匹配参数配置
    /*@Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer.setUseSuffixPatternMatch(false);
    }*/

}
